package com.esri.core.geometry;

import android.graphics.Matrix;
import android.graphics.Path;

/* loaded from: classes.dex */
public class GeometryUtil {
    public static final void segmentToPath(Path path, Polygon polygon, Matrix matrix) {
        AttributeStreamOfDbl attributeStreamOfDbl = (AttributeStreamOfDbl) ((MultiPathImpl) polygon._getImpl()).getAttributeStreamRef(0);
        AttributeStreamOfInt32 pathStreamRef = ((MultiPathImpl) polygon._getImpl()).getPathStreamRef();
        int i = 1;
        int i2 = 0;
        while (i < pathStreamRef.size()) {
            int read = pathStreamRef.read(i);
            for (int i3 = i2; i3 < read; i3++) {
                int i4 = i3 * 2;
                float[] fArr = {(float) attributeStreamOfDbl.read(i4), (float) attributeStreamOfDbl.read(i4 + 1)};
                matrix.mapPoints(fArr);
                if (i3 == i2) {
                    path.moveTo(fArr[0], fArr[1]);
                } else {
                    path.lineTo(fArr[0], fArr[1]);
                }
                if (i3 == read - 1) {
                    path.close();
                }
            }
            i++;
            i2 = read;
        }
    }

    public static final void segmentToPath(Path path, Polyline polyline, Matrix matrix) {
        AttributeStreamOfDbl attributeStreamOfDbl = (AttributeStreamOfDbl) ((MultiPathImpl) polyline._getImpl()).getAttributeStreamRef(0);
        AttributeStreamOfInt32 pathStreamRef = ((MultiPathImpl) polyline._getImpl()).getPathStreamRef();
        int i = 1;
        int i2 = 0;
        while (i < pathStreamRef.size()) {
            int read = pathStreamRef.read(i);
            for (int i3 = i2; i3 < read; i3++) {
                int i4 = i3 * 2;
                float[] fArr = {(float) attributeStreamOfDbl.read(i4), (float) attributeStreamOfDbl.read(i4 + 1)};
                matrix.mapPoints(fArr);
                if (i3 == i2) {
                    path.moveTo(fArr[0], fArr[1]);
                } else {
                    path.lineTo(fArr[0], fArr[1]);
                }
            }
            i++;
            i2 = read;
        }
    }
}
